﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace FwProject.Migrations
{
    public partial class Delete_DistributionHistory_To_fwyg : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "DistributionHistory");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "DistributionHistory",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    DistributionId = table.Column<Guid>(nullable: false),
                    OperatingUserId = table.Column<long>(nullable: false),
                    Record = table.Column<string>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DistributionHistory", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DistributionHistory_DistributionInfo_DistributionId",
                        column: x => x.DistributionId,
                        principalTable: "DistributionInfo",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_DistributionHistory_DistributionId",
                table: "DistributionHistory",
                column: "DistributionId");
        }
    }
}
